package com.zl.androidframework

import android.os.Bundle
import android.view.View
import android.widget.Button
import android.widget.TextView
import com.tencent.bugly.crashreport.CrashReport
import com.zl.lib_base.base.BaseFragment
import com.zl.lib_base.utils.AppUtil

/**
 * @Description: 首页
 * @Author: ZL
 * @CreateDate: 2021/12/4 17:20
 */
class HomeFragment : BaseFragment(R.layout.fragment_home) {

    override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
        super.onViewCreated(view, savedInstanceState)
        initView(view)
    }

    fun initView(view: View) {
        var btn_java_bugly: Button = view.findViewById(R.id.btn_java_bugly)
        var btn_nav_bugly: Button = view.findViewById(R.id.btn_nav_bugly)
        var btn_anr_bugly: Button = view.findViewById(R.id.btn_anr_bugly)
        var tv_version: TextView = view.findViewById(R.id.tv_version)

        btn_java_bugly.setOnClickListener {
            CrashReport.testJavaCrash()
        }

        btn_nav_bugly.setOnClickListener {
            CrashReport.testNativeCrash()
        }

        btn_anr_bugly.setOnClickListener {
            CrashReport.testANRCrash()
        }

        tv_version.text = AppUtil.getVersionName(activity)
    }
}